import * as fenxiao from '@/api/fenxiao.js';
const state = {};
const mutations = {};
const getters = {};
const actions = {
	//获取用户的推荐人和邀请人列表
	getReferrer({ commit }, payload = {}) {
		return new Promise((resolve, reject) => {
			fenxiao.getReferrer(payload).then(res => {
				resolve(res)
			}).catch(err => {
				reject(err)
			})
		})
	},
	//获取用户的佣金明细
	rewardList({ commit }, payload = {}) {
		return new Promise((resolve, reject) => {
			fenxiao.rewardList(payload).then(res => {
				resolve(res)
			}).catch(err => {
				reject(err)
			})
		})
	},
	//删除提现记录
	cashDel({ commit }, payload = {}) {
		return new Promise((resolve, reject) => {
			fenxiao.cashDel(payload).then(res => {
				resolve(res)
			}).catch(err => {
				reject(err)
			})
		})
	},
	//获取用户的佣金汇总
	rewardSummary({ commit }, payload = {}) {
		return new Promise((resolve, reject) => {
			fenxiao.rewardSummary(payload).then(res => {
				resolve(res)
			}).catch(err => {
				reject(err)
			})
		})
	},
	//提现记录
	cashList({ commit }, payload = {}) {
		return new Promise((resolve, reject) => {
			fenxiao.cashList(payload).then(res => {
				resolve(res)
			}).catch(err => {
				reject(err)
			})
		})
	},
	//新增提现/修改
	cashSave({ commit }, payload = {}) {
		return new Promise((resolve, reject) => {
			fenxiao.cashSave(payload).then(res => {
				resolve(res)
			}).catch(err => {
				reject(err)
			})
		})
	},
	//生成小程序码
	createAppletQRCode({commit},payload = {}){
		return new Promise((resolve,reject) => {
			fenxiao.createAppletQRCode(payload).then(res=>{
				resolve(res)
			}).catch(err=>{
				reject(err)
			})
		})
	},
	//获取推广排行
	rank({commit},payload = {}){
		return new Promise((resolve,reject) => {
			fenxiao.rank(payload).then(res=>{
				resolve(res)
			}).catch(err=>{
				reject(err)
			})
		})
	},
};

export default { state, getters, mutations, actions };
